package main

import (
	"github.com/gin-gonic/gin"
	"log/slog"
	"main/internal/controller"
	"main/internal/routers"
	"os"
)

func main() {
	InitLog()
	slog.Info("系统启动...")

	router := gin.Default() //默认引擎
	router.GET("/", func(ctx *gin.Context) {
		ctx.JSON(200, gin.H{
			"msg": "hello world!",
		})
	})

	// 导入路由器
	routers.AdminRouterInit(router)
	routers.ApiRouterInit(router)

	// 分模块路由器 导入
	controller.ZRouterInit(router)

	router.Run(":8000") //启动服务
}
func InitLog() {
	// 参考 https://juejin.cn/post/7096150148736090126
	handler := slog.NewJSONHandler(os.Stderr, nil)
	logger := slog.New(handler)
	slog.SetDefault(logger)
}
